package com.milo.list;

import org.junit.Test;

import java.util.Arrays;
import java.util.List;
import java.util.function.Consumer;

/**
 * @author: Milogenius
 * @create: 2019-01-03 16:06
 * @description:
 **/
public class ListTest {

    /**
     * 演示位运算
     */
    @Test
    public void test1() {
        int number = 10;
        System.out.println(number);
        number = number << 1;
        System.out.println(number);
        number = number >> 1;
        System.out.println(number);
    }

    @Test
    public void test2() {
        String s = "0,1,2";
        String[] split = s.split(",");
        List<String> strings = Arrays.asList(split);
        System.out.println(strings);
    }

    @Test
    public void test3() {
        String[] a = {"17", "52", "33", "412", "59", "62", "71"};
        List<String> list = Arrays.asList(a);
        //这个还是用的java8提供的新函数，但是没有用lambda表达式
        list.forEach(new Consumer<String>() {
            @Override
            public void accept(String t) {
                System.out.println(t);
            }
        });
    }
}
